<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=2">
<meta name="theme-color" content="#222">
<meta name="generator" content="Hexo 4.0.0">
  <link rel="apple-touch-icon" sizes="180x180" href="/blog/images/apple-touch-icon-next.png">
  <link rel="icon" type="image/png" sizes="32x32" href="/blog/images/favicon-32x32-next.png">
  <link rel="icon" type="image/png" sizes="16x16" href="/blog/images/favicon-16x16-next.png">
  <link rel="mask-icon" href="/blog/images/logo.svg" color="#222">
  <link rel="alternate" href="/blog/atom.xml" title="愿被世界温柔以待" type="application/atom+xml">

<link rel="stylesheet" href="/blog/css/main.css">

<link rel="stylesheet" href="//fonts.googleapis.com/css?family=Monda:300,300italic,400,400italic,700,700italic&display=swap&subset=latin,latin-ext">
<link rel="stylesheet" href="/blog/lib/font-awesome/css/font-awesome.min.css">


<script id="hexo-configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    hostname: new URL('https://skyperfect.gitee.io/blog').hostname,
    root: '/blog/',
    scheme: 'Mist',
    version: '7.5.0',
    exturl: false,
    sidebar: {"position":"left","display":"post","offset":12,"onmobile":false},
    copycode: {"enable":false,"show_result":false,"style":null},
    back2top: {"enable":true,"sidebar":false,"scrollpercent":false},
    bookmark: {"enable":false,"color":"#222","save":"auto"},
    fancybox: false,
    mediumzoom: false,
    lazyload: false,
    pangu: false,
    algolia: {
      appID: '',
      apiKey: '',
      indexName: '',
      hits: {"per_page":10},
      labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
    },
    localsearch: {"enable":false,"trigger":"auto","top_n_per_article":1,"unescape":false,"preload":false},
    path: '',
    motion: {"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}},
    sidebarPadding: 40
  };
</script>

  <meta name="description" content="安装和部署安装node.js官网 https:&#x2F;&#x2F;nodejs.org&#x2F;en&#x2F; 下载，一路next安装到指定路径下。安装Hexo1npm install -g hexo-cli初始化 指定一个文件夹存放你的Blog文件（也就是根目录） 12$ hexo init &amp;lt;folder&amp;gt;  # &amp;lt;folder&amp;gt;替换成你的文件夹地址，在这个地址里生成Hexo初始化文件例如 hexo">
<meta property="og:type" content="article">
<meta property="og:title" content="hexo博客指南">
<meta property="og:url" content="https:&#x2F;&#x2F;skyperfect.gitee.io&#x2F;blog&#x2F;2019&#x2F;11&#x2F;24&#x2F;hexo%E5%8D%9A%E5%AE%A2%E6%8C%87%E5%8D%97&#x2F;index.html">
<meta property="og:site_name" content="愿被世界温柔以待">
<meta property="og:description" content="安装和部署安装node.js官网 https:&#x2F;&#x2F;nodejs.org&#x2F;en&#x2F; 下载，一路next安装到指定路径下。安装Hexo1npm install -g hexo-cli初始化 指定一个文件夹存放你的Blog文件（也就是根目录） 12$ hexo init &amp;lt;folder&amp;gt;  # &amp;lt;folder&amp;gt;替换成你的文件夹地址，在这个地址里生成Hexo初始化文件例如 hexo">
<meta property="og:locale" content="zh-CN">
<meta property="og:updated_time" content="2019-12-08T13:49:29.758Z">
<meta name="twitter:card" content="summary">

<link rel="canonical" href="https://skyperfect.gitee.io/blog/2019/11/24/hexo%E5%8D%9A%E5%AE%A2%E6%8C%87%E5%8D%97/">


<script id="page-configurations">
  // https://hexo.io/docs/variables.html
  CONFIG.page = {
    sidebar: "",
    isHome: false,
    isPost: true,
    isPage: false,
    isArchive: false
  };
</script>

  <title>hexo博客指南 | 愿被世界温柔以待</title>
  






  <noscript>
  <style>
  .use-motion .brand,
  .use-motion .menu-item,
  .sidebar-inner,
  .use-motion .post-block,
  .use-motion .pagination,
  .use-motion .comments,
  .use-motion .post-header,
  .use-motion .post-body,
  .use-motion .collection-header { opacity: initial; }

  .use-motion .site-title,
  .use-motion .site-subtitle {
    opacity: initial;
    top: initial;
  }

  .use-motion .logo-line-before i { left: initial; }
  .use-motion .logo-line-after i { right: initial; }
  </style>
</noscript>

</head>

<body itemscope itemtype="http://schema.org/WebPage">
  <div class="container use-motion">
    <div class="headband"></div>

    <header class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-container">
  <div class="site-meta">

    <div>
      <a href="/blog/" class="brand" rel="start">
        <span class="logo-line-before"><i></i></span>
        <span class="site-title">愿被世界温柔以待</span>
        <span class="logo-line-after"><i></i></span>
      </a>
    </div>
  </div>

  <div class="site-nav-toggle">
    <div class="toggle" aria-label="切换导航栏">
      <span class="toggle-line toggle-line-first"></span>
      <span class="toggle-line toggle-line-middle"></span>
      <span class="toggle-line toggle-line-last"></span>
    </div>
  </div>
</div>


<nav class="site-nav">
  
  <ul id="menu" class="menu">
        <li class="menu-item menu-item-home">

    <a href="/blog/" rel="section"><i class="fa fa-fw fa-home"></i>首页</a>

  </li>
        <li class="menu-item menu-item-about">

    <a href="/blog/about/" rel="section"><i class="fa fa-fw fa-user"></i>关于</a>

  </li>
        <li class="menu-item menu-item-tags">

    <a href="/blog/tags/" rel="section"><i class="fa fa-fw fa-tags"></i>标签</a>

  </li>
        <li class="menu-item menu-item-categories">

    <a href="/blog/categories/" rel="section"><i class="fa fa-fw fa-th"></i>分类</a>

  </li>
        <li class="menu-item menu-item-archives">

    <a href="/blog/archives/" rel="section"><i class="fa fa-fw fa-archive"></i>归档</a>

  </li>
        <li class="menu-item menu-item-schedule">

    <a href="/blog/schedule/" rel="section"><i class="fa fa-fw fa-calendar"></i>日程表</a>

  </li>
  </ul>

</nav>
</div>
    </header>

    
  <div class="back-to-top">
    <i class="fa fa-arrow-up"></i>
    <span>0%</span>
  </div>

  <a href="https://github.com/skyie" class="github-corner" title="Follow me on GitHub" aria-label="Follow me on GitHub" rel="noopener" target="_blank"><svg width="80" height="80" viewBox="0 0 250 250" aria-hidden="true"><path d="M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z"></path><path d="M128.3,109.0 C113.8,99.7 119.0,89.6 119.0,89.6 C122.0,82.7 120.5,78.6 120.5,78.6 C119.2,72.0 123.4,76.3 123.4,76.3 C127.3,80.9 125.5,87.3 125.5,87.3 C122.9,97.6 130.6,101.9 134.4,103.2" fill="currentColor" style="transform-origin: 130px 106px;" class="octo-arm"></path><path d="M115.0,115.0 C114.9,115.1 118.7,116.5 119.8,115.4 L133.7,101.6 C136.9,99.2 139.9,98.4 142.2,98.6 C133.8,88.0 127.5,74.4 143.8,58.0 C148.5,53.4 154.0,51.2 159.7,51.0 C160.3,49.4 163.2,43.6 171.4,40.1 C171.4,40.1 176.1,42.5 178.8,56.2 C183.1,58.6 187.2,61.8 190.9,65.4 C194.5,69.0 197.7,73.2 200.1,77.6 C213.8,80.2 216.3,84.9 216.3,84.9 C212.7,93.1 206.9,96.0 205.4,96.6 C205.1,102.4 203.0,107.8 198.3,112.5 C181.9,128.9 168.3,122.5 157.7,114.1 C157.9,116.9 156.7,120.9 152.7,124.9 L141.0,136.5 C139.8,137.7 141.6,141.9 141.8,141.8 Z" fill="currentColor" class="octo-body"></path></svg></a>


    <main class="main">
      <div class="main-inner">
        <div class="content-wrap">
          

          <div class="content">
            

  <div class="posts-expand">
      
  
  
  <article itemscope itemtype="http://schema.org/Article" class="post-block " lang="zh-CN">
    <link itemprop="mainEntityOfPage" href="https://skyperfect.gitee.io/blog/blog/2019/11/24/hexo%E5%8D%9A%E5%AE%A2%E6%8C%87%E5%8D%97/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/blog/images/avatar.gif">
      <meta itemprop="name" content="brayden">
      <meta itemprop="description" content="记录工作，记录生活">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="愿被世界温柔以待">
    </span>
      <header class="post-header">
        <h1 class="post-title" itemprop="name headline">
          hexo博客指南
        </h1>

        <div class="post-meta">
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              <span class="post-meta-item-text">发表于</span>

              <time title="创建时间：2019-11-24 20:37:56" itemprop="dateCreated datePublished" datetime="2019-11-24T20:37:56+08:00">2019-11-24</time>
            </span>
              <span class="post-meta-item">
                <span class="post-meta-item-icon">
                  <i class="fa fa-calendar-check-o"></i>
                </span>
                <span class="post-meta-item-text">更新于</span>
                <time title="修改时间：2019-12-08 21:49:29" itemprop="dateModified" datetime="2019-12-08T21:49:29+08:00">2019-12-08</time>
              </span>
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="fa fa-folder-o"></i>
              </span>
              <span class="post-meta-item-text">分类于</span>
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/blog/categories/%E7%8E%AF%E5%A2%83%E6%90%AD%E5%BB%BA/" itemprop="url" rel="index">
                    <span itemprop="name">环境搭建</span>
                  </a>
                </span>
            </span>

          

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">

      
        <h2 id="安装和部署"><a href="#安装和部署" class="headerlink" title="安装和部署"></a>安装和部署</h2><p><strong>安装node.js</strong></p><p>官网 <a href="https://nodejs.org/en/" target="_blank" rel="noopener">https://nodejs.org/en/</a> 下载，一路next安装到指定路径下。</p><p><strong>安装Hexo</strong></p><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">npm install -g hexo-cli</span><br></pre></td></tr></table></figure><p><strong>初始化</strong></p><p> 指定一个文件夹存放你的Blog文件（也就是根目录） </p><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">$ hexo init &lt;folder&gt;  # &lt;folder&gt;替换成你的文件夹地址，在这个地址里生成Hexo初始化文件</span><br><span class="line">例如 hexo init blog,blog目录会自动生成出来</span><br></pre></td></tr></table></figure><a id="more"></a>








<p><strong>生成静态页面</strong></p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ hexo generate</span><br></pre></td></tr></table></figure>

<p> <strong>本地测试：开启服务器</strong> </p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">hexo server</span><br></pre></td></tr></table></figure>

<p> 一个最原始的本地Hexo博客就已经搭建好了。浏览器输入<code>http://localhost:4000</code>就可以看到类似如下效果 </p>
<p><strong>安装自动部署发布工具</strong> </p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">npm install hexo-deployer-git --save</span><br></pre></td></tr></table></figure>

<p><strong>发布博客</strong></p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">hexo clean</span><br><span class="line">hexo g -d   // 或者hexo generate &amp;&amp; hexo deploy</span><br></pre></td></tr></table></figure>



<h2 id="hexo和码云关联"><a href="#hexo和码云关联" class="headerlink" title="hexo和码云关联"></a>hexo和码云关联</h2><h2 id="hexo为文章分类"><a href="#hexo为文章分类" class="headerlink" title="hexo为文章分类"></a>hexo为文章分类</h2><p><strong>新建页面</strong></p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">hexo new page categories</span><br></pre></td></tr></table></figure>

<p> 这一步会在<code>/source/categories/</code>目录下生成一个<code>index.md</code>文档，编辑改文档，添加type如下，comment设置为false</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line">---</span><br><span class="line">title: categories</span><br><span class="line">date: 2019-11-24 20:57:30</span><br><span class="line">type: &quot;categories&quot;</span><br><span class="line">comment: false</span><br><span class="line">---</span><br></pre></td></tr></table></figure>

<p><strong>修改主题下的menu配置</strong></p>
<p>增加categories: /categories</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line">menu:</span><br><span class="line">  home: / </span><br><span class="line">  tags: /tags</span><br><span class="line">  categories: /categories</span><br><span class="line">  archives: /archives</span><br></pre></td></tr></table></figure>

<p><strong>为文章添加分类</strong></p>
<p>将之前post的md文件添加分类</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line">---</span><br><span class="line">title: 分布式消息中间件</span><br><span class="line">date: 2019-11-24 21:08:19</span><br><span class="line">tags:</span><br><span class="line">categories: 分布式</span><br><span class="line">---</span><br></pre></td></tr></table></figure>



<h2 id="hexo更换主题"><a href="#hexo更换主题" class="headerlink" title="hexo更换主题"></a>hexo更换主题</h2><h3 id="下载主题"><a href="#下载主题" class="headerlink" title="下载主题"></a>下载主题</h3><p>然后使用clone的方法将想要的主题下载下来。（我选用的是NexT主题）</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ git clone https://github.com/theme-next/hexo-theme-next themes/next</span><br></pre></td></tr></table></figure>

<h3 id="修改yml配置文件"><a href="#修改yml配置文件" class="headerlink" title="修改yml配置文件"></a>修改yml配置文件</h3><p>git克隆完成后，打开当前目录下的“_config.yml”配置文件。</p>
<p>找到theme的配置选项，一般在文件的最后。之后，将theme选项配置为我们新下载好的next主题即可。（“：”冒号之后空格不可少）</p>
<h3 id="调试发布"><a href="#调试发布" class="headerlink" title="调试发布"></a>调试发布</h3><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ hexo server --debug</span><br></pre></td></tr></table></figure>

<p>发布</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">$ hexo generate</span><br><span class="line">$ hexo deploy</span><br></pre></td></tr></table></figure>



<p>自动设置shadowsocks的自动化脚本</p>
<p> <a href="https://www.bbaaz.com/thread-7-1-1.html" target="_blank" rel="noopener">https://www.bbaaz.com/thread-7-1-1.html</a>   </p>
<h2 id="按照分类发布博文"><a href="#按照分类发布博文" class="headerlink" title="按照分类发布博文"></a>按照分类发布博文</h2><h2 id="hexo发布图片"><a href="#hexo发布图片" class="headerlink" title="hexo发布图片"></a>hexo发布图片</h2><h3 id="通过本地发布"><a href="#通过本地发布" class="headerlink" title="通过本地发布"></a>通过本地发布</h3><h3 id="通过七牛云"><a href="#通过七牛云" class="headerlink" title="通过七牛云"></a>通过七牛云</h3><p>注册七牛云账号，需要实名认证，绑定个人信息后，免费提供10G/月对象存储空间可以使用。</p>

    </div>

    
    
    

      <footer class="post-footer">

        


        
    <div class="post-nav">
      <div class="post-nav-item"></div>
      <div class="post-nav-item">
    <a href="/blog/2019/11/24/IDE%E5%A4%A7%E5%85%A8/" rel="next" title="IDE笔记">
      IDE笔记 <i class="fa fa-chevron-right"></i>
    </a></div>
    </div>
      </footer>
    
  </article>
  
  
  

  </div>


          </div>
          

        </div>
          
  
  <div class="toggle sidebar-toggle">
    <span class="toggle-line toggle-line-first"></span>
    <span class="toggle-line toggle-line-middle"></span>
    <span class="toggle-line toggle-line-last"></span>
  </div>

  <aside class="sidebar">
    <div class="sidebar-inner">

      <ul class="sidebar-nav motion-element">
        <li class="sidebar-nav-toc">
          文章目录
        </li>
        <li class="sidebar-nav-overview">
          站点概览
        </li>
      </ul>

      <!--noindex-->
      <div class="post-toc-wrap sidebar-panel">
          <div class="post-toc motion-element"><ol class="nav"><li class="nav-item nav-level-2"><a class="nav-link" href="#安装和部署"><span class="nav-number">1.</span> <span class="nav-text">安装和部署</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#hexo和码云关联"><span class="nav-number">2.</span> <span class="nav-text">hexo和码云关联</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#hexo为文章分类"><span class="nav-number">3.</span> <span class="nav-text">hexo为文章分类</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#hexo更换主题"><span class="nav-number">4.</span> <span class="nav-text">hexo更换主题</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#下载主题"><span class="nav-number">4.1.</span> <span class="nav-text">下载主题</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#修改yml配置文件"><span class="nav-number">4.2.</span> <span class="nav-text">修改yml配置文件</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#调试发布"><span class="nav-number">4.3.</span> <span class="nav-text">调试发布</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#按照分类发布博文"><span class="nav-number">5.</span> <span class="nav-text">按照分类发布博文</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#hexo发布图片"><span class="nav-number">6.</span> <span class="nav-text">hexo发布图片</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#通过本地发布"><span class="nav-number">6.1.</span> <span class="nav-text">通过本地发布</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#通过七牛云"><span class="nav-number">6.2.</span> <span class="nav-text">通过七牛云</span></a></li></ol></li></ol></div>
      </div>
      <!--/noindex-->

      <div class="site-overview-wrap sidebar-panel">
        <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
  <p class="site-author-name" itemprop="name">brayden</p>
  <div class="site-description" itemprop="description">记录工作，记录生活</div>
</div>
<div class="site-state-wrap motion-element">
  <nav class="site-state">
      <div class="site-state-item site-state-posts">
          <a href="/blog/archives/">
        
          <span class="site-state-item-count">12</span>
          <span class="site-state-item-name">日志</span>
        </a>
      </div>
      <div class="site-state-item site-state-categories">
            <a href="/blog/categories/">
          
        <span class="site-state-item-count">4</span>
        <span class="site-state-item-name">分类</span></a>
      </div>
  </nav>
</div>
  <div class="feed-link motion-element">
    <a href="/blog/atom.xml" rel="alternate">
      <i class="fa fa-rss"></i>RSS
    </a>
  </div>
  <div class="links-of-author motion-element">
      <span class="links-of-author-item">
        <a href="https://github.com/skyie" title="GitHub → https:&#x2F;&#x2F;github.com&#x2F;skyie" rel="noopener" target="_blank"><i class="fa fa-fw fa-github"></i>GitHub</a>
      </span>
  </div>



      </div>

    </div>
  </aside>
  <div id="sidebar-dimmer"></div>


      </div>
    </main>

    <footer class="footer">
      <div class="footer-inner">
        

<div class="copyright">
  
  &copy; 
  <span itemprop="copyrightYear">2019</span>
  <span class="with-love">
    <i class="fa fa-heart"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">brayden</span>
</div>
  <div class="powered-by">由 <a href="https://hexo.io/" class="theme-link" rel="noopener" target="_blank">Hexo</a> 强力驱动
  </div>
  <span class="post-meta-divider">|</span>
  <div class="theme-info">主题 – <a href="https://mist.theme-next.org/" class="theme-link" rel="noopener" target="_blank">NexT.Mist</a> v7.5.0
  </div>

        








        
      </div>
    </footer>
  </div>

  
  
  <script color='0,0,255' opacity='0.5' zIndex='-1' count='99' src="/blog/lib/canvas-nest/canvas-nest.min.js"></script>
  <script src="/blog/lib/anime.min.js"></script>
  <script src="/blog/lib/velocity/velocity.min.js"></script>
  <script src="/blog/lib/velocity/velocity.ui.min.js"></script>
<script src="/blog/js/utils.js"></script><script src="/blog/js/motion.js"></script>
<script src="/blog/js/schemes/muse.js"></script>
<script src="/blog/js/next-boot.js"></script>



  
















  

  

</body>
</html>
